package com.cd.card.domain;

import com.cd.common.domain.BaseDomain;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Index;
import javax.persistence.Table;
import java.util.Date;

@Entity
@Data
@Table(name = "lqq_card_record",indexes = {
        @Index(name = "idx_user_id", columnList = "user_id"),
        @Index(name = "idx_draw_time", columnList = "draw_time"),
})
@NoArgsConstructor
@AllArgsConstructor
public class LqqCardRecord extends BaseDomain {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "record_id", nullable = false)
    @Schema(title = "卡牌记录id")
    private Long recordId;

    @Column(name = "card_content", nullable = false,length = 15000)
    @Schema(title = "抽卡内容")
    private String cardContent;

    //减少数据库查询做的冗余 后期要删掉 用户名更新后这里不会同步 有隐患
    @Column(name = "user_name", nullable = false)
    @Schema(title = "用户名")
    private String userName;

    @Column(name = "user_id", nullable = false)
    @Schema(title = "用户id")
    private Long userId;

    @Column(name = "draw_time", nullable = false)
    @Schema(title = "抽卡时间")
    private Date drawTime;

    @Column(name = "draw_type", nullable = false)
    @Schema(title = "抽卡类型,单抽十抽福利等")
    private String drawType;

}
